// 吸顶菜单
$(() => {
    let $index_top_menu = $(".index_top_menu");
    let $limited_time = $(".limited_time");
    let $search_main = $(".search_main");
    let $please_login = $(".please_login");
    let $please_register = $(".please_register");
    let $shop_car = $(".shop_car");
    let $shop_car_menu = $(".shop_car_menu");
    let $header_classify = $(".header_classify");
    let $header_classify_secondary_menu = $(".header_classify_secondary_menu");
    let $index_footer = $(".index_footer");
    let $stairs = $(".fix_stairs");
    let $con = $(".con");
   
    $(window).scroll(function () {
        if ($("body,html").scrollTop() >= $limited_time.offset().top) {
            $index_top_menu.css({
                display: "block"
            })
            $search_main.css({
                position: "fixed",
                top: 0,
                zIndex: 99999,
                marginTop: "5px"
            })
            $please_login.css({
                position: "fixed",
                top: 0,
                zIndex: 99999,
                marginTop: "5px",
                marginLeft: "190px"
            })
            $please_register.css({
                position: "fixed",
                top: 0,
                zIndex: 99999,
                marginTop: "5px",
                marginLeft: "264px"
            })
            $shop_car.css({
                position: "fixed",
                height : "35px" ,
                top: 0,
                zIndex: 999999,
                marginTop: "4px",
                lineHeight:"36px",
                marginLeft: "345px",
                borderTop:"1px solid transparent"
            })
            $shop_car.mouseover(function(){
                $shop_car.css({
                    borderLeft : "1px solid #ddd",
                    borderRight:"1px solid #ddd",
                    borderTop:"1px solid #ddd"
                })
                $shop_car_menu.css({
                    display:"block"
                })
            })
            $shop_car.mouseout(function(){
                $shop_car.css({
                    borderLeft : "1px solid transparent",
                    borderRight:"1px solid transparent",
                    borderTop:"1px solid transparent"
                })
                $shop_car_menu.css({
                    display:"none"
                })
            })
            $shop_car_menu.css({
                width: "280px",
                height: "400px",
                top:"35px",
                left:"918px",
                float:"none",
                zIndex:99998,
                lineHeight:"44px",
                background:"#fff",
                marginLeft:"345px",

            })
            $header_classify.css({
                position: "fixed",
                top: 0,
                zIndex: 99999,
                marginTop: "5px",
            })
            $header_classify.mouseover(function(){
                $header_classify_secondary_menu.css({
                    display:"block"
                })
            })
            $header_classify.mouseout(function(){
                $header_classify_secondary_menu.css({
                    display:"none"
                })
            })
            $header_classify_secondary_menu.css({
                display:"none"
            })
        } else if ($("body,html").scrollTop() <= $limited_time.offset().top) {
            $index_top_menu.css({
                display: "none"
            })
            $search_main.css({
                border: "2px solid $always_color",
                borderTopLeftRadius: "12px",
                borderBottomLeftRadius: "12px",
                background: "#fff",
                width: "390px",
                height: "36px",
                paddingLeft: "28px",
                marginTop: "30px",
                position: "relative",
                zIndex: 1
            })
            $please_login.css({
                float: "left",
                // width: "58px",
                fontSize: "12px",
                lineHeight: "36px",
                textAlign: "center",
                borderLeft: "1px solid transparent",
                borderRight: "1px solid transparent",
                boxSizing: "border-box",
                position: "relative",
                marginLeft: 0,
                marginTop: 0,
                zIndex: 999
            })
            $please_register.css({
                float: "left",
                width: "70px",
                fontSize: "12px",
                lineHeight: "36px",
                textAlign: "center",
                borderLeft: "1px solid transparent",
                borderRight: "1px solid transparent",
                boxSizing: "border-box",
                position: "relative",
                marginLeft: 0,
                marginTop: 0,
                zIndex: 999
            })
            $shop_car.css({
                float: "left",
                width: "93px",
                color:"#F60",
                fontSize: "12px",
                lineHeight: "36px",
                height:"35px",
                textAlign: "center",
                borderLeft: "1px solid transparent",
                borderRight: "1px solid transparent",
                boxSizing: "border-box",
                position: "relative",
                zIndex: 999,
                marginLeft: 0,
                marginTop: 0,
            })
            $shop_car.mouseover(function(){
                $shop_car.css({
                    borderLeft : "1px solid #ddd",
                    borderRight:"1px solid #ddd"
                })
            })
            $shop_car.mouseout ( function(){
                $shop_car.css({
                    borderLeft : "1px solid transparent",
                    borderRight:"1px solid transparent"
                })
            })
            $shop_car_menu.css({
                width: "280px",
                height: "400px",
                top: "34px",
                position: "absolute",
                backgroundColor: "#fff",
                border: "1px solid #ddd",
                zIndex: -1,
                left: "-1px",
                padding: "20px 0",
            })
            $header_classify.css({
                position: "relative",
                backgroundColor: "#FF8000",
                width: "200px",
                height: "38px",
                color: "#fff",
                fontSize: "13px",
                fontWeight: "bold",
                borderRadius: "12px 12px 0 0",
                float: "left",
                paddingLeft: "36px",
                boxSizing: "border-box",
                marginTop:"0px"
            })
            $header_classify_secondary_menu.css({
                display:"block"
            })
            $header_classify.mouseout(function(){
                $header_classify_secondary_menu.css({
                    display:"block"
                })
            })
        }

         // 楼梯边界
        // console.log($index_footer.offset().top);
        if ($("body,html").scrollTop() >= $con.offset().top) {
            $stairs.css({
                display: "block"
            })
        }
        if ($("body,html").scrollTop() >= $index_footer.offset().top - 400) {
            $stairs.css({
                display: "none"
            })
        }
        if($("body,html").scrollTop() <= $con.offset().top + 200){
            $stairs.css({
                display: "none"
            })
        }

    })
})